package com.gee.spring.cloud.feign.flow.work.impl;

import com.gee.spring.cloud.feign.flow.binding.annotation.FlowArg;
import com.gee.spring.cloud.feign.flow.binding.annotation.TempVar;
import com.gee.spring.cloud.feign.flow.work.AbstractWork;

import java.lang.reflect.Method;

/**
 * desc:
 *
 * @author gee
 * @since 2021-04-01 16:15:47
 */
public class DefaultWork extends AbstractWork<Object> {

    private String id;

    public DefaultWork(String id, Object target, Method method, FlowArg[] argsAnnotations,
                        TempVar[] tempVars) {
        this.id = id;
        setTarget(target);
        setMethod(method);
        setArgsAnnotations(argsAnnotations);
        setTempVars(tempVars);
    }

    @Override
    public Object process(Object target, Method method, Object[] args) throws Exception {
        return method.invoke(target, args);
    }

    @Override
    public String getId() {
        return id;
    }

}
